<template>
  <!-- 合同信息 -->
  <div id="contractDetail" v-loading="loading">
    <el-form :model="form" label-width="100">
      <el-form-item label="客户名称:">
        <p>{{ form.customerName }}</p>
      </el-form-item>
      <el-form-item label="客户类型:">
        <p>{{ form.customertypeName }}</p>
      </el-form-item>
      <el-form-item label="联系人:">
        <p>{{ form.firstcontacter }}</p>
      </el-form-item>
      <el-form-item label="联系人号码:">
        <p>{{ form.phone }}</p>
      </el-form-item>
      <el-form-item label="座机号码:">
        <p>{{ form.telephone }}</p>
      </el-form-item>
      <el-form-item label="邮箱:">
        <p>{{ form.email }}</p>
      </el-form-item>
      <el-form-item label="传真:">
        <p>{{ form.fax }}</p>
      </el-form-item>
      <el-form-item label="法定代表人:">
        <p>{{ form.legalAdmin }}</p>
      </el-form-item>
      <el-form-item label="公司性质:">
        <p>{{ form.companyTypeName }}</p>
      </el-form-item>
      <el-form-item label="行业:">
        <p>{{ form.professionName }}</p>
      </el-form-item>
      <el-form-item label="员工人数:">
        <p>{{ form.numberofemployees }}</p>
      </el-form-item>
      <el-form-item label="开户行名称:">
        <p>{{ form.bankName }}</p>
      </el-form-item>
      <el-form-item label="银行账号:">
        <p>{{ form.bankAccount }}</p>
      </el-form-item>
      <el-form-item label="支付方式:">
        <p>{{ form.paymethodName }}</p>
      </el-form-item>
      <el-form-item label="结算方式:">
        <p v-if="form.settlement == 1">现结</p>
        <p v-if="form.settlement == 2">月结</p>
      </el-form-item>
      <el-form-item label="地址:">
        <p>{{ form.address }}</p>
      </el-form-item>
      <el-form-item label="备注:" style="width: 100%">
        <p>{{ form.memo }}</p>
      </el-form-item>
      <el-form-item label="业务员:" style="width: 100%">
        <p>{{ form.applicantName }}</p>
      </el-form-item>
      <el-form-item label="审核状态:" style="width: 100%">
        <p v-if="form.status == 0" style="color: #e6a23c">待审核</p>
        <p v-if="form.status == 1" style="color: #67c23a">通过</p>
        <p v-if="form.status == 2" style="color: #f56c6c">未通过</p>
        <p v-if="form.status == 3" style="color: #ff9b31">审核中</p>
      </el-form-item>
      <el-form-item label="创建时间:">
        <p>{{ form.createTime }}</p>
      </el-form-item>
      <el-form-item label="修改时间:" v-if="form.updateTime">
        <p>{{ form.updateTime }}</p>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'contractDetail',
  data () {
    return {
      form: {},
      customType: [], // 客户类型
      companyType: [], // 企业性质
      professionList: [],//行业列表
      paymethodType: [],// 付款方式
      loading: false,
    }
  },
  beforeMount () {
    this.getDetail()
  },
  methods: {
    async getDetail () {
      this.loading = true
      let { data } = await this.$API.contract.detailList.getCustomerDetail.get({ contractId: this.$route.query.id })
      this.loading = false
      this.form = data
      this.getType()
    },
    // 获取类型
    async getType () {
      // 客户类型
      this.customType = await queryTypeByDic('customerType')
      // 企业性质
      this.companyType = await queryTypeByDic('companyType')
      //行业类型
      this.professionList = await queryTypeByDic('industryType')
      // 付款方式
      this.paymethodType = await queryTypeByDic('payment')
      this.customType.forEach(item => {
        if (item.value == this.form.customertype) {
          this.form.customertypeName = item.name
        }
      })
      this.companyType.forEach(item => {
        if (item.value == this.form.natureofbusiness) {
          this.form.companyTypeName = item.name
        }
      })
      this.professionList.forEach(item => {
        if (item.value == this.form.profession) {
          this.form.professionName = item.name
        }
      })
      this.paymethodType.forEach(item => {
        if (item.value == this.form.paymethod) {
          this.form.paymethodName = item.name
        }
      })
    },
  }
}
</script>
<style lang='scss' scoped>
</style>